/*
 * 
 * Created on Jul 30, 2005
 */
package remato.client.view.editor.properties;

import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.forms.editor.FormPage;
import org.eclipse.ui.part.IPageSite;
import org.eclipse.ui.views.properties.IPropertySheetEntry;
import org.eclipse.ui.views.properties.PropertySheetPage;
import org.eclipse.ui.views.properties.PropertySheetSorter;

/**
 * 
 * @author Petter L. H. Eide
 * @version $Id: ModelPropertySheetPage.java,v 1.1 2006-01-23 19:58:36 petterei Exp $
 * 
 * Changelog:
 * 
 * $Log: ModelPropertySheetPage.java,v $
 * Revision 1.1  2006-01-23 19:58:36  petterei
 * initial commit for client, fitting the alternative session implementation
 *
 * Revision 1.2  2005-12-12 05:58:15  petterei
 * - fixed columns-with in properties-editor
 * - udate of property-sets-tables
 *
 * Revision 1.1  2005-12-08 14:51:22  petterei
 * *** empty log message ***
 *
 * Revision 1.1  2005/09/29 16:41:42  petterei
 * *** empty log message ***
 *
 * Revision 1.1  2005/08/23 06:38:13  peide3
 * *** empty log message ***
 *
 * Revision 1.1  2005/07/31 22:55:10  petterei
 * initial commit
 *
 *
 */
public class ModelPropertySheetPage extends PropertySheetPage {

    class ExtendedPropertySheetSorter extends PropertySheetSorter {
        @Override
        public void sort(@SuppressWarnings("unused") IPropertySheetEntry[] entries) {
        }
    }
    
    class ModelPageSite implements IPageSite {
		private ISelectionProvider provider = null;
    	private FormPage page = null;

    	public ModelPageSite(FormPage page) {
    		this.page = page;
    	}
    	
		/**
		 * @see org.eclipse.ui.part.IPageSite#getActionBars()
		 */
		public IActionBars getActionBars() {
			return page.getEditorSite().getActionBars();
		}

		/**
		 * @see org.eclipse.ui.part.IPageSite#registerContextMenu(java.lang.String, org.eclipse.jface.action.MenuManager, org.eclipse.jface.viewers.ISelectionProvider)
		 */
		public void registerContextMenu(@SuppressWarnings("unused") String menuId, @SuppressWarnings("unused") MenuManager menuManager, @SuppressWarnings("unused") ISelectionProvider selectionProvider) {
			return;
		}

		/**
		 * @see org.eclipse.ui.IWorkbenchSite#getPage()
		 */
		public IWorkbenchPage getPage() {
			return page.getSite().getPage();
		}

		/**
		 * @see org.eclipse.ui.IWorkbenchSite#getSelectionProvider()
		 */
		public ISelectionProvider getSelectionProvider() {
			return provider;
		}

		/**
		 * @see org.eclipse.ui.IWorkbenchSite#getShell()
		 */
		public Shell getShell() {
			return page.getSite().getShell();
		}

		/**
		 * @see org.eclipse.ui.IWorkbenchSite#getWorkbenchWindow()
		 */
		public IWorkbenchWindow getWorkbenchWindow() {
			return page.getSite().getWorkbenchWindow();
		}

		public void setSelectionProvider(ISelectionProvider provider) {
			this.provider = provider;
		}
		public Object getAdapter(@SuppressWarnings("unused") Class adapter) {
			return null;
		}
    	public Object getService(Class api) {
			return null;
		}
		public boolean hasService(Class api) {
			return false;
		}
    }

	public void init (FormPage page) {
		ModelPageSite pageSite = new ModelPageSite(page);
		super.init(pageSite);
	}
	/**
     * @see org.eclipse.ui.views.properties.PropertySheetPage#createControl(org.eclipse.swt.widgets.Composite)
     */
    @Override
    public void createControl(Composite parent) {
        super.createControl(parent);
        setSorter( new ExtendedPropertySheetSorter() );
    }
}
